<template>
	<view class="already">
		<navBar title="已结算订单"></navBar>
		<view class="list_box" v-for="(item,index) in list" :key="index" style="border-bottom: 2rpx solid #666;">
			<view class="list" @click="ondown(index)">
				<view class="left">
					<view class="name hidden">提现{{item.order_list ? item.order_list.length : 0}}笔</view>
					<view class="text hidden">审核状态：{{item.status == 1 ? '申请中' : item.status == 2 ? '审核成功' : '已拒绝'}}</view>
					<view class="text hidden">订单编号：{{item.order_sn}}</view>
					<view class="text hidden">完成时间：
						<uni-dateformat :date="item.create_time" format="MM-dd hh:mm"></uni-dateformat>
					</view>
				</view>
				<view class="right">
					<i>￥</i>{{ Number(item.price).toFixed(2) }}
				</view>
			</view>
			
			<view v-if="item.order_list && showindex == index" class="list" v-for="(val,i) in item.order_list" :key="i">
				<view class="left">
					<view class="name hidden">{{val.name}}</view>
					<view class="text hidden">订单编号：{{val.order_sn}}</view>
				</view>
				<view class="right"></view>
			</view>
		</view>
		<empty v-if="!list.length && total == 0"></empty>
		<view class="loading" v-if="!list.length && total == 1">
			<HevuLoading type="loading4" :opacity="0" loadingText="加载中..." text-color="#FD2A53"
				loadingIconColor="#FD2A53" />
		</view>
	</view>
</template>

<script>
	import empty from '@/compentents/empty/empty.vue';
	import navBar from '@/compentents/navBar/navBar.vue'
	import HevuLoading from '@/components/hevu-loading/hevu-loading.vue';
	export default {
		components: {
			empty,
			navBar,
			HevuLoading
		},
		data() {
			return {
				page: 1,
				list: [],
				total: 1,
				
				showindex: -1,
			}
		},
		methods: {
			getList() {
				this.$get('/user_withdrawal/getWithdrawalLog', {
					page: this.page,
					status: '1,3',
					type: 1,
					withdrawal_type: 1
				}).then(res => {
					this.total = res.data.total;
					this.list.push(...res.data.data);
				})
			},
			ondown(index){
				if(this.showindex == index){
					this.showindex = -1;
				}else {
					this.showindex = index;
				}
			},
		},

		onLoad() {
			this.getList();
		},

		onReachBottom() {
			if (this.total > this.list.length) {
				this.page++;
				this.getList();
			}
		}
	}
</script>

<style scoped lang="less">
	.already {
		min-height: 100vh;
		background: #FFFFFF;
		padding: 32rpx;
	}

	.list {
		display: flex;
		align-items: flex-end;
		padding: 30rpx 0;

		.left {
			flex: 1;
			overflow: hidden;

			.name {
				font-weight: 500;
				font-size: 32rpx;
				color: #131313;
			}

			.text {
				padding-top: 8rpx;
				font-size: 24rpx;
				color: #999999;
				line-height: 32rpx;
			}

		}

		.right {
			i {
				font-style: normal;
				font-size: 28rpx;
			}

			font-weight: 600;
			color: #131313;
			font-size: 40rpx;
		}
	}
</style>